import { Map } from "immutable";
import * as actionTypes from "./constance";

const defaultState = Map({
  userDetailInfo: [],
  userImgInfo: [],
  userAudioInfo: [],
  userListenRankInfo: [],
  userPlaylistInfo: [],
  userFollowsInfo: [],
  userFansInfo: [],
  userEventInfo: [],
  commentEventInfo: [],
});

const a = (state = defaultState, action) => {
  switch (action.type) {
    case actionTypes.GET_USERDETAIL:
      return state.set("userDetailInfo", action.userDetailInfo);
    case actionTypes.GET_USERIMG:
      return state.set("userImgInfo", action.userImgInfo);
    case actionTypes.GET_USERAUDIO:
      return state.set("userAudioInfo", action.userAudioInfo);
    case actionTypes.GET_USERLISTENRANK:
      return state.set("userListenRankInfo", action.userListenRankInfo);
    case actionTypes.GET_USERPLAYLIST:
      return state.set("userPlaylistInfo", action.userPlaylistInfo);
    case actionTypes.GET_USERFOLLOWS:
      return state.set("userFollowsInfo", action.userFollowsInfo);
    case actionTypes.GET_USERFANS:
      return state.set("userFansInfo", action.userFansInfo);
    case actionTypes.GET_USEREVENT:
      return state.set("userEventInfo", action.userEventInfo);
    case actionTypes.GET_COMMENTEVENT:
      return state.set("commentEventInfo", action.commentEventInfo);
    default:
      return state;
  }
};

export default a;
